package com.woniu.account.controller;


import com.woniu.account.dto.CoachInfoDto;
import com.woniu.account.form.CoachInfoPerfectForm;
import com.woniu.account.form.RealNameAuthenticationForm;
import com.woniu.account.model.TCoachInfo;
import com.woniu.account.service.TCoachInfoService;
import com.woniu.account.service.TCoachService;
import com.woniu.core.util.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import javax.validation.Valid;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author 吴彦祖
 * @since 2024年04月02日
 */
@RestController
@RequestMapping("/tCoachInfo")
@Api(tags = "教练详情表相关接口")
public class TCoachInfoController {
    @Resource
    private TCoachInfoService tCoachInfoService;
    @GetMapping("/CoachInfoById/{coachId}.coach")
    @ApiOperation("根据教练id查询简历")
    public Result<CoachInfoDto> CoachInfoById(@PathVariable("coachId") Integer coachId){
        CoachInfoDto dto = tCoachInfoService.CoachInfoById(coachId);
        return Result.getResult(CoachInfoDto.class).setMsg("查询成功").setData(dto);
    }

    @ApiOperation("教练实名认证")
    @PostMapping("/realNameAuthentication.coach")
    public Result<String> coachRealNameAuthentication(@RequestBody RealNameAuthenticationForm form)throws Exception{
        String str = tCoachInfoService.coachRealNameAuthentication(form);
        return Result.getResult(String.class).setMsg("教练实名认证成功").setData(str);
    }

    @ApiOperation("(简历)教练个人信息完善")
    @PostMapping("/coachInfoPerfect.coach")
    public Result coachInfoPerfect(@RequestBody @Valid CoachInfoPerfectForm form) throws Exception{
        TCoachInfo tCoachInfo=tCoachInfoService.coachInfoPerfect(form);
        return Result.getResult(TCoachInfo.class).setMsg("查询成功").setData(tCoachInfo);
    }

    @ApiOperation("教练信息状态修改 1展示 0隐藏")
    @GetMapping("/setCoachInfoState.coach")
    public Result<String> setCoachInfoState() throws Exception{
        String s = tCoachInfoService.setCoachInfoState();
        return Result.getResult(String.class).setMsg(s);
    }
}

